package com.braska.grave.netty.server.service;

import com.braska.grave.netty.annotation.Service;
import com.braska.grave.netty.api.model.Node;
import com.braska.grave.netty.api.service.INettyService;
import com.google.common.collect.Lists;

import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * @author shenyuhang
 * @date 2020/3/31
 **/
@Service
public class NettyService implements INettyService {
    @Override
    public String getString() {
        return "welcome to use netty rpc.";
    }

    @Override
    public Node getNode() {
        return new Node().setId("1").setName("node1");
    }

    @Override
    public List<String> getList() {
        return Lists.newArrayList("hello java.", "hello netty.");
    }

    @Override
    public List<Node> getNodes() {
        return Lists.newArrayList(new Node().setId("1").setName("node1"));
    }

    @Override
    public Map getMap() {
        return Collections.singletonMap("word", "hello world.");
    }
}
